﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using CAT_C_Event;

public class MessageHint : MonoBehaviour
{
    // Start is called before the first frame update

    public string m_strTitle;
    public string m_strMsg;

    private void Awake()
    {
        print("----------------------a-------------------\n");
        Invoke("register_KB_Events", 1.0f);
    }
    void Start()
    {
        print("-------------------------s----------------\n");
    }        

    // Update is called once per frame
    void Update()
    {
        
    }
    private void register_KB_Events()
    {
        KBEngine.Event.registerOut(CAT_C_Event.CCE_Event.onMessageHint, this, "onMessageHint");
    }

    public void onClickedConfirm()
    {
        transform.gameObject.SetActive(false);
    }

    public void conCliekedCancel()
    {
        transform.gameObject.SetActive(false);
    }

    public void onMessageHint(string strMsg, string strTitle,bool bConfirm)
    {
        //        GameObject.Find("MsgTitle/Title").gameObject.val
        transform.Find("MsgTitle/Title").GetComponent<UILabel>().text = strTitle;
        transform.Find("ShowMsg/Msg").GetComponent<UILabel>().text = strMsg;
        transform.gameObject.SetActive(!transform.gameObject.activeInHierarchy);
    }
}
